home *** CD-ROM | disk | FTP | other *** search
/ The Original Shareware 1.1 / The Original Shareware (WeMake CDs)(Volume 1.1)(CDs, Inc)(1993).iso / 19 / madtrb14.zip / TESTINVC.PAS < prev    next >
Pascal/Delphi Source File  |  1985-05-17  |  2KB  |  63 lines

  1. (*--------------------------------------------------------------------------*)
  2. (*                 TestInvC --- Test inverse chi-square                     *)
  3. (*--------------------------------------------------------------------------*)
  4.  
  5. PROGRAM TestInvC;
  6.  
  7. (*--------------------------------------------------------------------------*)
  8. (*                                                                          *)
  9. (*   Program:  TestInvC                                                     *)
  10. (*                                                                          *)
  11. (*   Purpose:  Demonstrate inverse chi-square routine in PIBSIGS            *)
  12. (*                                                                          *)
  13. (*   Usage:    This program prompts for a p-value and degrees of freedom.   *)
  14. (*             It computes and prints the corresponding percentage point    *)
  15. (*             of the chi-square distribution.   Note:  the input           *)
  16. (*             probability is the tail value, not the cumulative value.     *)
  17. (*                                                                          *)
  18. (*             To stop the program, enter a negative p-value.               *)
  19. (*                                                                          *)
  20. (*   Calls:    Cinv                                                         *)
  21. (*                                                                          *)
  22. (*--------------------------------------------------------------------------*)
  23.  
  24. VAR
  25.    Chisq:    REAL;
  26.    Df:       REAL;
  27.    P:        REAL;
  28.    Done:     BOOLEAN;
  29.    Ierr:     INTEGER;
  30.  
  31. (*$I SIGCONST.PAS *)
  32. (*$I LOGTEN.PAS   *)
  33. (*$I POWER.PAS    *)
  34. (*$I POWERI.PAS   *)
  35. (*$I POWTEN.PAS   *)
  36. (*$I ALGAMA.PAS   *)
  37. (*$I GAMMAIN.PAS  *)
  38. (*$I SIGCHI.PAS   *)
  39. (*$I NINV.PAS     *)
  40. (*$I CINV.PAS     *)
  41.  
  42. BEGIN (* TestInvC *)
  43.  
  44.    Done := FALSE;
  45.    ClrScr;
  46.  
  47.    REPEAT
  48.  
  49.       WRITE('Enter tail probability value and degrees of freedom: ');
  50.       READLN( P , Df );
  51.  
  52.       IF ( P > 0.0 ) THEN
  53.          BEGIN
  54.             Chisq := Cinv( P , Df , Ierr );
  55.             WRITELN('Chi-square percentage point = ',Chisq:12:5);
  56.          END
  57.       ELSE
  58.          Done := TRUE;
  59.  
  60.    UNTIL Done;
  61.  
  62.  
  63. END   (* TestInvC *).